/*
 * | UNFINISHED CODE | | UNFINISHED CODE | | UNFINISHED CODE |
 */

package p1;

import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;;

public class Plan {
	private List<Semester> _semesters;
	private short _id;
	public static short DEFAULT_ID = 0;
	
	public Plan(){
		_semesters = new ArrayList<Semester>();
		_id = Plan.DEFAULT_ID;
	}
	
	public List<Semester> getSemesters()
	{ return ((List<Semester>) ((ArrayList<Semester>) _semesters).clone());	}
	public void setSemesters(List<Semester> semesters)
	{ _semesters = (List<Semester>)((ArrayList<Semester>)semesters).clone(); }
	
	public void addSemester(Semester s)
	{ _semesters.add(s); }
	public boolean removeSemester(Semester s)
	{ 
		Iterator<Semester> it = _semesters.iterator();
		while(it.hasNext()){
			Semester temp = (Semester)it.next();
			if(temp.getYear() == s.getYear()
					&& temp.getSeason() == s.getSeason())
				{
				_semesters.remove(temp);
					return true;
				}
		}
		return false;
	}
}
